package com.example.drive.material.controller;


import com.example.drive.coach.pojo.entity.Check;
import com.example.drive.coach.pojo.entity.Register;
import com.example.drive.common.R;
import com.example.drive.material.pojo.Material;
import com.example.drive.material.service.MaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@RestController
@RequestMapping("material")
public class MaterialController {

    @Autowired
    private MaterialService materialService;

    /**
     * 获取照片材料
     * @return
     */
    @GetMapping("MaterList")
    public R<List<Material>> getMaterialList(){
        List<Material> materialList = materialService.getMaterial();
        return R.ok(materialList);
    }

    /**
     * 删除打回材料
     * @param id
     * @return
     */
    @DeleteMapping("deleteMater/{id}")
    public R<Void> deleteMaterial(@PathVariable  Integer id){
          materialService.deleteMaterial(id);
          return R.ok();
    }
    /**
     * 获取体检表
     * @return
     */
    @GetMapping("CheckList")
    public R<List<Check>> getCheckList(){
        List<Check> checkList = materialService.getCheck();
        return R.ok(checkList);
    }
    /**
     * 删除打回体检
     * @param id
     * @return
     */
    @DeleteMapping("deleteCheck/{id}")
    public R<Void> deleteCheck(@PathVariable  Integer id){
        materialService.deleteCheck(id);
        return R.ok();
    }

    /**
     * 获取注册表
     * @return
     */
    @GetMapping("RegisterList")
    public R<List<Register>> getRegisterList(){
        List<Register> registerList = materialService.getRegister();
        return R.ok(registerList);
    }
    /**
     * 删除打回注册
     * @param id
     * @return
     */
    @DeleteMapping("deleteRegister/{id}")
    public R<Void> deleteRegister(@PathVariable  Integer id){
        materialService.deleteRegister(id);
        return R.ok();
    }

}
